Optimal. Leaf size=131 \[ -\left (\left (c^2 C+2 B c d-C d^2-A \left (c^2-d^2\right )\right ) x\right )-\frac {\left (2 c (A-C) d+B \left (c^2-d^2\right )\right ) \log (\cos (e+f x))}{f}+\frac {d (B c+(A-C) d) \tan (e+f x)}{f}+\frac {B (c+d \tan (e+f x))^2}{2 f}+\frac {C (c+d \tan (e+f x))^3}{3 d f} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.10, antiderivative size = 131, normalized size of antiderivative = 1.00, number of steps
used = 4, number of rules used = 4, integrand size = 33, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.121, Rules used = {3711, 3609,
3606, 3556} \begin {gather*} -\frac {\left (2 c d (A-C)+B \left (c^2-d^2\right )\right ) \log (\cos (e+f x))}{f}-x \left (-A \left (c^2-d^2\right )+2 B c d+c^2 C-C d^2\right )+\frac {d \tan (e+f x) (d (A-C)+B c)}{f}+\frac {B (c+d \tan (e+f x))^2}{2 f}+\frac {C (c+d \tan (e+f x))^3}{3 d f} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 3556
Rule 3606
Rule 3609
Rule 3711
Rubi steps
\begin {align*} \int (c+d \tan (e+f x))^2 \left (A+B \tan (e+f x)+C \tan ^2(e+f x)\right ) \, dx &=\frac {C (c+d \tan (e+f x))^3}{3 d f}+\int (A-C+B \tan (e+f x)) (c+d \tan (e+f x))^2 \, dx\\ &=\frac {B (c+d \tan (e+f x))^2}{2 f}+\frac {C (c+d \tan (e+f x))^3}{3 d f}+\int (c+d \tan (e+f x)) (A c-c C-B d+(B c+(A-C) d) \tan (e+f x)) \, dx\\ &=-\left (c^2 C+2 B c d-C d^2-A \left (c^2-d^2\right )\right ) x+\frac {d (B c+(A-C) d) \tan (e+f x)}{f}+\frac {B (c+d \tan (e+f x))^2}{2 f}+\frac {C (c+d \tan (e+f x))^3}{3 d f}+\left (2 c (A-C) d+B \left (c^2-d^2\right )\right ) \int \tan (e+f x) \, dx\\ &=-\left (c^2 C+2 B c d-C d^2-A \left (c^2-d^2\right )\right ) x-\frac {\left (2 c (A-C) d+B \left (c^2-d^2\right )\right ) \log (\cos (e+f x))}{f}+\frac {d (B c+(A-C) d) \tan (e+f x)}{f}+\frac {B (c+d \tan (e+f x))^2}{2 f}+\frac {C (c+d \tan (e+f x))^3}{3 d f}\\ \end {align*}
________________________________________________________________________________________
Mathematica [C] Result contains complex when optimal does not.
time = 0.73, size = 176, normalized size = 1.34 \begin {gather*} \frac {2 C (c+d \tan (e+f x))^3+3 (B c+(-A+C) d) \left (i \left ((c+i d)^2 \log (i-\tan (e+f x))-(c-i d)^2 \log (i+\tan (e+f x))\right )-2 d^2 \tan (e+f x)\right )+3 B \left ((i c-d)^3 \log (i-\tan (e+f x))-(i c+d)^3 \log (i+\tan (e+f x))+6 c d^2 \tan (e+f x)+d^3 \tan ^2(e+f x)\right )}{6 d f} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.08, size = 162, normalized size = 1.24
method | result | size |
norman | \(\left (A \,c^{2}-A \,d^{2}-2 B c d -c^{2} C +C \,d^{2}\right ) x +\frac {\left (A \,d^{2}+2 B c d +c^{2} C -C \,d^{2}\right ) \tan \left (f x +e \right )}{f}+\frac {C \,d^{2} \left (\tan ^{3}\left (f x +e \right )\right )}{3 f}+\frac {d \left (B d +2 c C \right ) \left (\tan ^{2}\left (f x +e \right )\right )}{2 f}+\frac {\left (2 A c d +B \,c^{2}-B \,d^{2}-2 c C d \right ) \ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{2 f}\) | \(141\) |
derivativedivides | \(\frac {\frac {C \,d^{2} \left (\tan ^{3}\left (f x +e \right )\right )}{3}+\frac {B \,d^{2} \left (\tan ^{2}\left (f x +e \right )\right )}{2}+C c d \left (\tan ^{2}\left (f x +e \right )\right )+A \,d^{2} \tan \left (f x +e \right )+2 B c d \tan \left (f x +e \right )+c^{2} C \tan \left (f x +e \right )-C \,d^{2} \tan \left (f x +e \right )+\frac {\left (2 A c d +B \,c^{2}-B \,d^{2}-2 c C d \right ) \ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{2}+\left (A \,c^{2}-A \,d^{2}-2 B c d -c^{2} C +C \,d^{2}\right ) \arctan \left (\tan \left (f x +e \right )\right )}{f}\) | \(162\) |
default | \(\frac {\frac {C \,d^{2} \left (\tan ^{3}\left (f x +e \right )\right )}{3}+\frac {B \,d^{2} \left (\tan ^{2}\left (f x +e \right )\right )}{2}+C c d \left (\tan ^{2}\left (f x +e \right )\right )+A \,d^{2} \tan \left (f x +e \right )+2 B c d \tan \left (f x +e \right )+c^{2} C \tan \left (f x +e \right )-C \,d^{2} \tan \left (f x +e \right )+\frac {\left (2 A c d +B \,c^{2}-B \,d^{2}-2 c C d \right ) \ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{2}+\left (A \,c^{2}-A \,d^{2}-2 B c d -c^{2} C +C \,d^{2}\right ) \arctan \left (\tan \left (f x +e \right )\right )}{f}\) | \(162\) |
risch | \(-2 i C c d x +i B \,c^{2} x +\frac {2 i B \,c^{2} e}{f}+2 i A c d x +A \,c^{2} x -A \,d^{2} x -2 B c d x -C \,c^{2} x +C \,d^{2} x -\frac {4 i C c d e}{f}-i B \,d^{2} x +\frac {2 i \left (-3 i B \,d^{2} {\mathrm e}^{2 i \left (f x +e \right )}-3 i B \,d^{2} {\mathrm e}^{4 i \left (f x +e \right )}+3 A \,d^{2} {\mathrm e}^{4 i \left (f x +e \right )}+6 B c d \,{\mathrm e}^{4 i \left (f x +e \right )}+3 C \,c^{2} {\mathrm e}^{4 i \left (f x +e \right )}-6 C \,d^{2} {\mathrm e}^{4 i \left (f x +e \right )}-6 i C c d \,{\mathrm e}^{4 i \left (f x +e \right )}-6 i C c d \,{\mathrm e}^{2 i \left (f x +e \right )}+6 A \,d^{2} {\mathrm e}^{2 i \left (f x +e \right )}+12 B c d \,{\mathrm e}^{2 i \left (f x +e \right )}+6 C \,c^{2} {\mathrm e}^{2 i \left (f x +e \right )}-6 C \,d^{2} {\mathrm e}^{2 i \left (f x +e \right )}+3 A \,d^{2}+6 B c d +3 c^{2} C -4 C \,d^{2}\right )}{3 f \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right )^{3}}-\frac {2 i B \,d^{2} e}{f}+\frac {4 i A c d e}{f}-\frac {2 \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right ) A c d}{f}-\frac {\ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right ) B \,c^{2}}{f}+\frac {\ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right ) B \,d^{2}}{f}+\frac {2 \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right ) c C d}{f}\) | \(410\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.52, size = 140, normalized size = 1.07 \begin {gather*} \frac {2 \, C d^{2} \tan \left (f x + e\right )^{3} + 3 \, {\left (2 \, C c d + B d^{2}\right )} \tan \left (f x + e\right )^{2} + 6 \, {\left ({\left (A - C\right )} c^{2} - 2 \, B c d - {\left (A - C\right )} d^{2}\right )} {\left (f x + e\right )} + 3 \, {\left (B c^{2} + 2 \, {\left (A - C\right )} c d - B d^{2}\right )} \log \left (\tan \left (f x + e\right )^{2} + 1\right ) + 6 \, {\left (C c^{2} + 2 \, B c d + {\left (A - C\right )} d^{2}\right )} \tan \left (f x + e\right )}{6 \, f} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 5.63, size = 138, normalized size = 1.05 \begin {gather*} \frac {2 \, C d^{2} \tan \left (f x + e\right )^{3} + 6 \, {\left ({\left (A - C\right )} c^{2} - 2 \, B c d - {\left (A - C\right )} d^{2}\right )} f x + 3 \, {\left (2 \, C c d + B d^{2}\right )} \tan \left (f x + e\right )^{2} - 3 \, {\left (B c^{2} + 2 \, {\left (A - C\right )} c d - B d^{2}\right )} \log \left (\frac {1}{\tan \left (f x + e\right )^{2} + 1}\right ) + 6 \, {\left (C c^{2} + 2 \, B c d + {\left (A - C\right )} d^{2}\right )} \tan \left (f x + e\right )}{6 \, f} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [B] Leaf count of result is larger than twice the leaf count of optimal. 241 vs.
\(2 (107) = 214\).
time = 0.14, size = 241, normalized size = 1.84 \begin {gather*} \begin {cases} A c^{2} x + \frac {A c d \log {\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )}}{f} - A d^{2} x + \frac {A d^{2} \tan {\left (e + f x \right )}}{f} + \frac {B c^{2} \log {\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )}}{2 f} - 2 B c d x + \frac {2 B c d \tan {\left (e + f x \right )}}{f} - \frac {B d^{2} \log {\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )}}{2 f} + \frac {B d^{2} \tan ^{2}{\left (e + f x \right )}}{2 f} - C c^{2} x + \frac {C c^{2} \tan {\left (e + f x \right )}}{f} - \frac {C c d \log {\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )}}{f} + \frac {C c d \tan ^{2}{\left (e + f x \right )}}{f} + C d^{2} x + \frac {C d^{2} \tan ^{3}{\left (e + f x \right )}}{3 f} - \frac {C d^{2} \tan {\left (e + f x \right )}}{f} & \text {for}\: f \neq 0 \\x \left (c + d \tan {\left (e \right )}\right )^{2} \left (A + B \tan {\left (e \right )} + C \tan ^{2}{\left (e \right )}\right ) & \text {otherwise} \end {cases} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 2128 vs.
\(2 (131) = 262\).
time = 1.41, size = 2128, normalized size = 16.24 \begin {gather*} \text {Too large to display} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 8.81, size = 141, normalized size = 1.08 \begin {gather*} \frac {{\mathrm {tan}\left (e+f\,x\right )}^2\,\left (\frac {B\,d^2}{2}+C\,c\,d\right )}{f}-x\,\left (A\,d^2-A\,c^2+C\,c^2-C\,d^2+2\,B\,c\,d\right )+\frac {\mathrm {tan}\left (e+f\,x\right )\,\left (A\,d^2+C\,c^2-C\,d^2+2\,B\,c\,d\right )}{f}+\frac {\ln \left ({\mathrm {tan}\left (e+f\,x\right )}^2+1\right )\,\left (\frac {B\,c^2}{2}-\frac {B\,d^2}{2}+A\,c\,d-C\,c\,d\right )}{f}+\frac {C\,d^2\,{\mathrm {tan}\left (e+f\,x\right )}^3}{3\,f} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________